//
//  BaseTableViewController.swift
//  WeiBo
//
//  Created by 佘红响 on 15/11/7.
//  Copyright © 2015年 she. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController {

    /// 记录访客是否登录
    var loginFlag: Bool = false
    /// 记录 "访客视图"
    var visitorView: VisitorView?
    
    override func loadView() {
        loginFlag ? super.loadView() : setupVisitorView()
    }
    
    /**
    添加 "访客视图"
    */
    func setupVisitorView() {
        
        let viView = VisitorView.createVisitorView()
        visitorView = viView
        view = visitorView
        
        navigationItem.leftBarButtonItem = UIBarButtonItem.init(title: "注册", style: UIBarButtonItemStyle.Done, target: self, action: Selector("register"))
        
        navigationItem.rightBarButtonItem = UIBarButtonItem.init(title: "登录", style: UIBarButtonItemStyle.Done, target: self, action: Selector("login"))
    }
    
    @objc private func register() {
        HXLog("注册")
    }
    
    @objc private func login() {
        HXLog("登录")
    }
    
}
